package xkp.lesson4;

/**
 * 该类能够装载任意数据
 * 比如登录成功
 * code=101  loginSuccess
 * data={UserInfo对象}
 * msg: login成功
 * @author Administrator
 *
 */

/*
 * 可能遇到的场景：
 * 1、登录成功返回用户信息 code=101  data={UserInfo对象},msg="登录成功"
 * 2、登录失败,code:501 data=null,msg="登录失败"
 *   
 */
public class Result <T> {
	/**
	 * 状态码   
	 */
	private Integer code;
	
	/**
	 * 主要数据
	 */
	private T data;
	
	
	/**
	 * 该数据的说明信息
	 */
	private String msg;
	
	
	public Result() {
		// TODO Auto-generated constructor stub
	}
	
	public Result(Integer code, T data, String msg) {
		super();
		this.code = code;
		this.data = data;
		this.msg = msg;
	}




	public Integer getCode() {
		return code;
	}


	public void setCode(Integer code) {
		this.code = code;
	}


	public T getData() {
		return data;
	}


	public void setData(T data) {
		this.data = data;
	}


	public String getMsg() {
		return msg;
	}


	public void setMsg(String msg) {
		this.msg = msg;
	}

	@Override
	public String toString() {
		return "Result [code=" + code + ", data=" + data + ", msg=" + msg + "]";
	}

}
